"""author: wenyao
   data: 2021/12/10
   project: cjh
"""
#self代表的是当前对象，而非类
# class Person():
#     name = "sc"
#     def info(self):
#         print(f'i am {self.name}')
#         print(self)
#         print(self.__class__)
#     def info2(self):
#         self.info()
#         print("this is info2")
# p = Person()
# p.info()  #--->Person.info(p)
# Person.info(p)
#
# p2 = Person()
# p2.info()  #  Person.info(p2)

#self  不一定非写成self
#约定俗成  大家都使用self
#实例方法里面 第一个参数就代表实例本身，所以不一定非写成self
# class Person():
#     name = "sc"
#     def info(this):
#         print(f'i am {this.name}')
#         print(this)
#         print(this.__class__)
#     def info2(this):
#         this.info()
#         print("this is info2")
# p = Person()
# p.info()

#可以不使用self
# class Person():
#     name = "sc"
#     def info(this):
#         print(f'i am {this.name}')
#         print(this)
#         print(this.__class__)
#     #放在类空间里的普通函数
#     #不能通过实例调用
#     def info2():
#         print("this is info2")
#     def info3(self, x):
#         print("this is info2")
#         print(f"my age is {x.age}")
# p = Person()
# p1 = Person()
# p1.age = 100
# #p.info2()  #  --> Person.info2(p)
# Person.info2()
# p.info3(p1)  #-->Person.info3(p,p1)